﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using DevExpress.Web.ASPxCallback;

public partial class DxExpress_ASPxCallback : System.Web.UI.Page
{
    public class Details
    {
        public int id
        {
            set;
            get;
        }

        public string Description
        {
            set;
            get;
        }

        public string result
        {
            set;
            get;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            BindDataList(); 
        }
        if (IsCallback)
            System.Threading.Thread.Sleep(500); // Intentionally pauses server-side processing, to demonstrate the Loading Panel functionality.
    }

    protected void ASPxCallback1_Callback(object source, CallbackEventArgs e)
    {
        List<Details> ds = GetDetailsList();
        if (ds != null)
            e.Result = ds.Where(o => o.id == Int32.Parse(e.Parameter)).First().result;
    }

    private void BindDataList()
    {
        List<Details> ds = GetDetailsList();
        this.DataList1.DataSource = ds;
        this.DataList1.DataBind();
    }

    private List<Details> GetDetailsList()
    {
        List<Details> ds = new List<Details>();
        Details s1 = new Details();
        s1.id = 1;
        s1.Description = "Developer Express Announces eXpressApp Framework Beta ";
        s1.result = "December 19, 2006 - Developer Express is proud to announce the immediate availability of eXpressApp Framework Beta 1. ";
        ds.Add(s1);
        Details s2 = new Details();
        s2.id = 2;
        s2.Description = "Announcing a New Executable Ribbon Notepad Demo built with the upcoming ExpressBars v6 ";
        s2.result = "December 1, 2006 - We are happy to announce the immediate availability of the executable Ribbon Notepad Demo built with the upcoming ExpressBars Suite v6 – the only comprehensive toolbar-menu & docking system for the VCL.";
        ds.Add(s2);
        Details s3 = new Details();
        s3.id = 3;
        s3.Description = "Developer Express Announces DXperience 2006 vol 3 ";
        s3.result = "November 20, 2006 - Developer Express is proud to announce the immediate availability of DXperience v2006, vol 3. ";
        ds.Add(s3);
        Details s4 = new Details();
        s4.id = 4;
        s4.Description = "ExpressBars v6 Beta is Available to Subscribers ";
        s4.result = "November 17, 2006 - We are happy to announce the immediate availability of the ExpressBars v6 Beta to our active VCL Subscribers. ExpressBars v6 represents the most significant upgrade to this product library since its initial release over 7 years ago. Among key features introduced in v6 is support for Microsoft's newest toolbar/menu system – the Ribbon.";
        ds.Add(s4);
        Details s5 = new Details();
        s5.id = 5;
        s5.Description = "The ExpressQuantumGrid Suite v6 is Now Available ";
        s5.result = "November 17, 2006 - We are happy to announce the immediate availability of the ExpressQuantumGrid Suite v6 – the most comprehensive and feature rich product library of its kind for the VCL. ";
        ds.Add(s5);
        Details s6 = new Details();
        s6.id = 6;
        s6.Description = "Developer Express Announces DXperience 2006 vol 2 ";
        s6.result = "August 24, 2006 - Developer Express is proud to announce the immediate availability of DXperience v2006, vol 2.";
        ds.Add(s6);
        return ds;
    }
}
